package com.sniper.web.utils;

import com.alibaba.fastjson.JSONObject;
import com.sniper.model.BaseEntity;
import com.sniper.utils.HttpUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 获取用户访问新闻纪录
 * Created by suzhen on 2017/8/10.
 */
@Component
public class IPPostViewUtil {

    static Logger logger = LoggerFactory.getLogger(IPPostViewUtil.class);

    @Value("${taobao_ip_url}")
    private String taobao_ip_url;


    public IPBack getIP(String ip) {
        String ipBack = HttpUtil.sendGet(taobao_ip_url + ip, "");
        return JSONObject.parseObject(ipBack, IPBack.class);
    }


    public static class IPBack extends BaseEntity {
        private static final long serialVersionUID = -7752598266625020133L;
        Integer code;

        public IPBack() {
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }


    }

}
